/**
 * Created by AllanXu on 01/03/2016.
 */
define(function (require) {
	var Vue = require('vue'),
		Config = require('config'),
		_ = require('ajax'),
		utilities = require('utilities');

	var app = new Vue({
		el: '#uc_sign',
		data: {
			renderObj: {},
			member: {},
			increase: 0
		},
		methods: {
			init: function () {
				app.member = utilities.base64TojsonObj(sessionStorage.userInfo).member;
				_(Config.SERVICE.USERCENTER.LOAD_CHECKIN, {
					id: sessionStorage.id
				}, function (data) {
					app.increase = data.obj.configNum;
				});
			},
			checkin: function () {
				_(Config.SERVICE.USERCENTER.CHECKIN, {
					id: sessionStorage.id
				}, function (data) {
					if (data.code == 200 && data.type === 'SUCCESS') {
						alert('签到成功！');
						utilities.refreshUserInfo(function (data) {
							location.reload();
						});
					}
				});
			}
		}
	});
	app.init();
});